﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMSSyncData.Model;
using WMSSyncData.Model.WMSModel;
using WMSSyncData.Utils;

namespace WMSSyncData.DAL.SqlDB
{
    public class Tddev117DAL : BaseSqlDBDAL<tddev117>
    {
        public List<tddev117> GetSyncData()
        {

            var sql = string.Format(@"select NEWID() AS GUID,ISRM.RelatedBill AS orno,IQC.RowNo AS pono,IQC.OrderNo AS seqn,
                                    IQC.PartNumber AS item,IQC.Storage_SN AS cwar,' ' as loca,IQC.FGQty AS qapa ,IQC.Unit AS apun ,0 AS qdes,
                                    ' ' AS resd,IQC.NGQty AS qrjr,case when isnull(NGReason,'')='' then ' ' else NGReason end AS resn,1 AS host,' ' AS mess,GETDATE() as edte1,
                                    GETDATE() as wdte1,GETDATE() as wdte2,0 as REFCNTD,0 as REFCNTU ,case when isnull(IQC.Ext3,' ')=' ' then ' ' else IQC.Ext3 end  as ncrf from wms_T_IQC IQC INNER 
                                    JOIN wms_T_InStockRM ISRM ON IQC.BillNo=ISRM.BillNo  where ISRM.Status='3'");

            var dt = SqlDBHelper.GetDataSet(sql).Tables[0];

            var list = MakeTablePackage(dt);

            return list;
        }


    }
}
